package com.cskaoyan.exception;


import com.cskaoyan.bean.BaseRespVo;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@ControllerAdvice
public class ExceptionControllerAdvice {

    @ExceptionHandler(UsernameException.class)
    public String usernameException() {
        return "/login.jsp";
    }

    @ExceptionHandler(PasswordException.class)
    public String passwordException() {
        return "/password.jsp";
    }

    @ExceptionHandler(YuanzhiException.class)
    @ResponseBody
    public BaseRespVo yuanzhiException() {
        return BaseRespVo.fail("远志警告");
    }

}
